<template>
	<view class="content">
		<view class="home_tab">
			<view class="home_tab_title">
				<view class="title_inner">
					<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" style-type="text" active-color="#d4237a">
					</uni-segmented-control>
				</view>
				<view class="iconfont iconsearch">
		
			
				</view>
			</view>


		</view>
		






		<view class="home_tab_content">
			<view v-if="current === 0">

				<home-album></home-album>
			</view>
			<view v-if="current === 1">
				<home-category></home-category>
			</view>
			<view v-if="current === 2">
				<home-new></home-new>
			</view>
			<view v-if="current === 3">
				<home-recommend></home-recommend>
			</view>
		</view>

	</view>
</template>

<script>
	import homeAlbum from "./home-album/index.vue"
	import homeCategory from "./home-category/index.vue"
	import homeNew from "./home-new/index.vue"
	import homeRecommend from "./home-recommend/index.vue"
	import uniSegmentedControl from "@/components/uni-segmented-control/uni-segmented-control.vue"
	export default {
		


		components: {
			homeAlbum,
			homeCategory,
			homeNew,
			homeRecommend,
			uniSegmentedControl



		},
		data() {
			return {
				items: ['推荐', '分类', '最新', '专辑'],
				// [{
				// 		title: "推荐"
				// 	},
				// 	{
				// 		title: "分类"
				// 	},
				// 	{
				// 		title: "最新"
				// 	},
				// 	{
				// 		title: "专辑"
				// 	}
				// ],

				current: 0
			}
		},
		methods: {
			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex;
				}
			}
		}
		

		// onLoad() {
		// 	// http://157.122.54.189:9088/image/v3/homepage/vertical
		// 	//原生微信小程序的api
		// 	wx.request({
		// 		url:"http://157.122.54.189:9088/image/v3/homepage/vertical",
		// 		success(res) {
		// 			console.log(res);	
		// 		}
		// 	})
		// 	//  2 uni-api
		// 	uni.request({

		// 		url:"http://157.122.54.189:9088/image/v3/homepage/vertical",
		// 	})
		// 	.then(res=>{
		// 		console.log(res);
		// 	})
		// }
	}
	
</script>

<style lang="scss">
	.home_tab {
		.home_tab_title {
			position: relative;
			.title_inner{
				width: 60%;
				margin: 0 auto;
			
			}
			.iconsearch {
				position: absolute;
				top: 50%;
				transform: translateY(-50%);
				right: 5%;
			}

			

		}


	}
</style>
